//	--------------------------------------------------------------------
//	Copyright(C) 2006,2007 Zhao Yukun. All rights reserved.
//	This file is a part of the Xeres system.
//	Xeres 2007
//	Contact : xeres.engine@gmail.com
//	$(reservedInfo)
//	$(reservedDeclaration)
//	--------------------------------------------------------------------
///	@file	<CMainBatch.cpp>
///	@path	~/src/graphics/batch/
///	@date	2008/04/26
///	@desc	.

#include "config/config.h"

#include "graphics/batch/CMainBatch.h"

namespace xeres {

	IMPL_IOBJECT_CLASS_DYNAMIC( CMainBatch );

	// CMainBatch
	CMainBatch::CMainBatch( void )
	{
		m_models = new CStaticModelBatch;
		m_dc = new CDrawCallsBatch;
	}
	// ~CMainBatch
	CMainBatch::~CMainBatch( void )
	{
	}
	// BeginBatch
	void CMainBatch::BeginBatch( void )
	{
		m_models->BeginBatch();
		m_dc->BeginBatch();
	}
	// EndBatch
	void CMainBatch::EndBatch( void )
	{
		m_models->EndBatch();
		m_dc->EndBatch();
	}
	// Render
	void CMainBatch::Render( RenderContext& rc )
	{
		m_models->Render( rc );
		m_dc->Render( rc );
	}
	// BatchDrawCall
	void CMainBatch::BatchDrawCall( const function<void(RenderContext&)>& dc )
	{
		m_dc->AddDrawCall( dc );
	}
	// BatchModel
	void CMainBatch::BatchModel( RefWeak<IModel> model )
	{
		m_models->AddModel( model );
	}

} // namespace xeres
